<?php defined('BASEPATH') OR exit('No direct script access allowed'); ?><!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="Bookmark" href="/favicon.ico" >
    <link rel="Shortcut Icon" href="/favicon.ico" />
    <!--[if lt IE 9]>
    <script type="text/javascript" src="/public/js/html5shiv.js"></script>
    <script type="text/javascript" src="/public/js/respond.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="/public/plugins/h-ui/css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="/public/plugins/h-ui.admin/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="/public/plugins/Hui-iconfont/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="/public/plugins/h-ui.admin/skin/default/skin.css" id="skin" />
    <link rel="stylesheet" type="text/css" href="/public/plugins/h-ui.admin/css/style.css" />
    <script type="text/javascript" src="/public/plugins/My97DatePicker/WdatePicker.js"></script>
    
    <!--[if IE 6]>
    <script type="text/javascript" src="/public/js/DD_belatedPNG_0.0.8a-min.js" ></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <title>快方管理后台</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <style type="text/css">
        .input-text{
            width: 100px;
            background: none;
        }
        .cb_label{
            padding: 0 5px;
        }
        .cb_label input{
            margin-right: 2px;
        }
        .input-text{
            width: 100%;
        }
    </style>
</head>
<body class="big-page">
<h3 style="padding-left: 20px;">创建门店<small>&emsp;<?=$name ?></small></h3>
<form id="form">
<table class="table table-border" id="mytable">
    <tr>
        <td style="text-align: right;">门店ID：</td>
        <td id="store_id"><?=$data['ID'] ?></td>
    </tr>
    <tr>
        <td style="text-align: right;">门店地址：</td>
        <td><?=$data['Address'] ?></td>
    </tr>
    <tr>
        <td style="text-align: right;">门店经度：</td>
        <td><?php if($data['JinDuX']>$data['WeiDuY']) {echo $data['JinDuX'];}else{echo $data['WeiDuY'];} ?></td>
    </tr>
    <tr>
        <td style="text-align: right;">门店纬度：</td>
        <td><?php if($data['JinDuX']>$data['WeiDuY']) {echo $data['WeiDuY'];}else{echo $data['JinDuX'];} ?></td>
    </tr>
    <tr>
        <td style="text-align: right;">客服电话号码：</td>
        <td><?=$data['Tel'] ?></td>
    </tr>
    <tr>
        <td colspan="2">&nbsp;</td>
    </tr>
    
    <tr>
        <td style="text-align: right;">第三方门店ID：</td>
        <td><input class="input-text radius" type="text" name="chn_store_id" value=""></td>
    </tr>
    
    <tr>
        <td style="text-align: right;">门店名称：</td>
        <td><input class="input-text radius" type="text" name="store_name" value="<?=$data['Caption'] ?>"></td>
    </tr>
    <tr>
        <td style="text-align: right;">营业开始时间：</td>
        <td><input class="input-text radius" type="text" name="start_time" onClick="WdatePicker({el:this,dateFmt:'HH:mm:ss'})" value="08:30:00"></td>
    </tr>
    <tr>
        <td style="text-align: right;">营业结束时间：</td>
        <td><input class="input-text radius" type="text" name="end_time" onClick="WdatePicker({el:this,dateFmt:'HH:mm:ss'})" value="18:30:00"></td>
    </tr>
    
        <input type="hidden" name="create_url" value="<?=$data['create_url'] ?>">
        <input type="hidden" name="chn_id" value="<?=$data['chn_id'] ?>">
    
    <tr>
        <td colspan="2" style="text-align: center;">
            <input type="button" class="btn btn-info radius" value="确认">&emsp;
        </td>
    </tr>
</table>
</form>
<script type="text/javascript" src="/public/js/jquery.min.js"></script>
<script type="text/javascript" src="/public/plugins/layer/layer.js"></script>
<script type="text/javascript" src="/public/plugins/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="/public/plugins/h-ui.admin/js/H-ui.admin.js"></script>
<script type="text/javascript" src="/public/plugins/jquery.contextmenu/jquery.contextmenu.r2.js"></script>
<script type="text/javascript">
//创建门店
$(".btn").bind("click", function(){
    var store_id = $("#store_id").html();
    var chn_store_id = $("input[name='chn_store_id']").val();
    var chn_id = $("input[name='chn_id']").val();
    var store_name = $("input[name='store_name']").val();
    var start_time = $("input[name='start_time']").val();
    var end_time = $("input[name='end_time']").val();
    var url = $("input[name='create_url']").val();
    
    $.ajax({
        url: url,
        type: "POST",
        dataType: "json",
        data: {store_id:store_id,chn_store_id:chn_store_id,store_name:store_name,start_time:start_time,end_time:end_time},
        success:function(res){
            if(res.errNo == 0){
                alert("创建门店成功");
                parent.dataTables.draw(false);
                parent.layer.closeAll();
            }else if(chn_id == 1){
                alert(res.data.error.msg);
            }else if(chn_id == 2){
                alert(res.data.error);
            }else if(chn_id == 4){
                alert(res.data.error.message);
            }

        }
    });     
})
</script>
</body>
</html>
